﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace MyClever.Lib
{
    public abstract class PluginBuilder : MarshalByRefObject
    {
        protected string className;
        protected PluginPath path;
        protected ProgrammingLanguage programmingLanguage;
        protected Dictionary<PluginProperty, object> properties;
        protected List<PackageDefinition> packages;

        public PluginPath Path
        {
            get { return this.path; }
        }

        public string ClassName
        {
            get { return this.className; }
        }

        public ProgrammingLanguage ProgrammingLanguage
        {
            get { return this.programmingLanguage; }
        }

        public Dictionary<PluginProperty, object> Properties
        {
            get { return this.properties; }
        }

        public List<PackageDefinition> PackageDefinitions
        {
            get { return this.packages; }
        }

        public PluginBuilder(PluginPath pluginPath, string pluginClass, ProgrammingLanguage programmingLanguage)
        {
            this.path = pluginPath;
            this.className = pluginClass;
            this.programmingLanguage = programmingLanguage;
            
            this.packages = new List<PackageDefinition>();
            this.properties = new Dictionary<PluginProperty, object>();

            this.properties.Add(PluginProperty.Maintainer, this.path.Maintainer);
            this.properties.Add(PluginProperty.Name, this.path.Name);
            this.properties.Add(PluginProperty.Version, this.path.Version);
        }
        
        public abstract void ExtractProperties();
        public abstract void ExtractPackages();

        public abstract object GetInstance();
    }
}
